#include "windowprocesswin.h"
#include "ui_windowprocesswin.h"
#include <QDebug>
#include <QWindow>
#include <Windows.h>
WindowProcessWin::WindowProcessWin(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::WindowProcessWin)
{
    ui->setupUi(this);
    qDebug()<<this->winId();
}

WindowProcessWin::~WindowProcessWin()
{
    delete ui;
}

void WindowProcessWin::on_pushButton_clicked()
{
    //1.获取windows上面窗口的id号
    //0x000F0554
    WId wid = (WId)FindWindow(L"WeWorkWindow",L"企业微信");

    //2.根据winid创建QWindow窗口
    QWindow *window = QWindow::fromWinId(wid);

    if(window)
    {
        window->setFlags(window->flags()|Qt::WindowTitleHint);
        //3.根据QWindow创建QWidget
        QWidget *myWidget = QWidget::createWindowContainer(window,ui->widget);
        myWidget->resize(ui->widget->size());
        myWidget->show();
    }


}
